*****************************************************************************************************
***Replication Files: Electoral Rules, Women's Representation and the Qualification of Politicians***
*****************************************************************************************************

****************************
***Descriptive Statistics***
****************************

use "~/Downloads/1987_2013_elected.dta", clear  
cd "~/Downloads"
xtset ID year


*TABLE 1 - ALL LEVELS

//PANEL A
estpost tabstat  male nat_subnat post_reform year macro_regions reg_magn , /* 
	 */  statistics( mean median min max ) /* 
	 */  columns(variables)
	* esttab using "~/Downloads/Table1_A.tex",  /* 
	 */ cells("male(fmt(3)) nat_subnat(fmt(3)) post_reform(fmt(3)) year(fmt(3)) macro_regions(fmt(3)) reg_magn(fmt(3))") /* 
	 */     title("Summary Statistics: Panel Data, All Levels") ///  
	  replace //nonum noobs
	  

//PANEL B - PRE-TREATMENT CONTROL
preserve

drop if year >= 2005       

estpost tabstat male nat_subnat post_reform year macro_regions reg_magn if nat_sub == 0, /* 
	 */  statistics( mean median min max ) /* 
	 */  columns(variables)
	* esttab using "~/Downloads/Table1_B.tex",  /* 
	  */ cells("male(fmt(3)) nat_subnat(fmt(3)) post_reform(fmt(3)) year(fmt(3)) macro_regions(fmt(3)) reg_magn(fmt(3))") /* 
	 */     title("Summary Statistics: Control Only, Pre-Treatment")  ///  
	 *  replace //nonum noobs

//PANEL C - PRE-TREATMENT TREATED
estpost tabstat male nat_subnat post_reform year macro_regions reg_magn if nat_sub == 1, /* 
	 */  statistics( mean median min max ) /* 
	 */  columns(variables)
	* esttab using "~/Downloads/Table1_C.tex",  /* 
	  */ cells("male(fmt(3)) nat_subnat(fmt(3)) post_reform(fmt(3)) year(fmt(3)) macro_regions(fmt(3)) reg_magn(fmt(3))") /* 
	 */     title("Summary Statistics: Treated Only, Pre-Treatment")  ///  
	 *  replace //nonum noobs

restore 	


*TABLE 2 - NATIONAL ONLY, 1994-2001

use "~/Downloads/national_1994-2001.dta", clear 

estpost tabstat male age years_school dyn_subnat_car incumbent, /* 
 */  statistics( mean median min max ) /* 
 */  columns(variables)
* esttab using "~/Downloads/Table2.tex"  /* 
 */ cells("male(fmt(3)) age(fmt(3)) years_school(fmt(3)) dyn_subnat_car(fmt(3)) incumbent(fmt(3))") /* 
*/     title("Summary Statistics: 1994/2001, National Only")  ///  
  replace //nonum noobs

  
*TABLE 3 - NATIONAL ONLY, 2013

use "~/Downloads/national_2013.dta", clear 

estpost tabstat male age edu dyn_subnat incumbent, /* 
 */  statistics( mean median min max ) /* 
 */  columns(variables)
* esttab using "~/Downloads/Table3.tex",  /* 
 */ cells("male(fmt(3)) age(fmt(3)) edu(fmt(3)) dyn_subnat_car(fmt(3)) incumbent(fmt(3))") /* 
*/     title("Summary Statistics: 2013, National Only")  ///  
replace //nonum noobs

